package cn.t.web.device;

import cn.t.core.controller.BaseController;
import cn.t.dto.android.DeviceAndroidConfigDTO;
import cn.t.facade.android.DeviceAndroidConfigFacade;
import cn.t.request.DeviceAndroidConfigEditReq;
import cn.t.vo.FunctionConfigDetailVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 设备管理 - 功能配置
 *
 * @author t
 * @since 2024-05-24 10:15:13
 */
@Slf4j
@RestController
@RequestMapping("deviceAndroidConfig")
@AllArgsConstructor
public class DeviceAndroidConfigController extends BaseController<DeviceAndroidConfigDTO, DeviceAndroidConfigFacade> {

    /**
     * 添加功能配置
     */
    @PostMapping({"add"})
    public Boolean add(@Valid @RequestBody DeviceAndroidConfigDTO dto) {
        return this.facade.add(dto);
    }

    /**
     * 功能配置详情
     */
    @GetMapping("detail/{configId}")
    public FunctionConfigDetailVO detail(@PathVariable Long configId, @RequestParam Boolean isEdit) {
        return facade.detail(configId, isEdit);
    }

    /**
     * 编辑功能配置
     */
    @PostMapping("config")
    public Boolean config(@Validated @RequestBody DeviceAndroidConfigEditReq request) {
        return facade.config(request);
    }


}

